
//- This Source Code Form is subject to the terms of the Mozilla Public
//- License, v. 2.0. If a copy of the MPL was not distributed with this
//- file, You can obtain one at http://mozilla.org/MPL/2.0/.
//-
//- Copyright (c) 2021-present Kaleidos Ventures SL

doctype html

div.wrapper(
    tg-user-notifications
    ng-controller="UserNotificationsController as ctrl",
    ng-init="section='mail-notifications'"
)

    sidebar.menu-secondary.sidebar.settings-nav(tg-user-settings-navigation="mail-notifications")
        include ../includes/modules/user-settings-menu

    section.main.admin-common
        header
            h1 {{sectionName | translate}}

        div(ng-if="!ctrl.isSaas")
            p.total(translate="NOTIFICATION.COMMUNICATION")

            .newsletter-email.setting
                p(translate="PROJECT.NEWSLETTER_OPENING.NOTIFY_EXPLANATION")
                button.btn-small.subscribed-button(
                    ng-if="!ctrl.onPremiseSubscribed"
                    ng-click="ctrl.subscribed()"
                )
                    span(translate="PROJECT.NEWSLETTER_OPENING.SUBSCRIBE")
                    img.loading-spinner(
                        ng-if="ctrl.loadPremise"
                        src="#{v}/svg/spinner-circle.svg",
                        alt="{{'COMMON.LOADING' | translate}}"
                    )
                button.btn-small.subscribed(
                    variant="secondary"
                    ng-if="ctrl.onPremiseSubscribed"
                )
                    span(translate="PROJECT.NEWSLETTER_OPENING.SUBSCRIBED")
                    tg-svg.check-sub(svg-icon="icon-check-empty")

                .text-container
                    p.text-info
                        span.italic(
                            translate="PROJECT.NEWSLETTER_OPENING.NO_SHARE"
                        )
                        br
                        span.italic(translate="PROJECT.NEWSLETTER_OPENING.OPT_OUT")

        p.total(translate="NOTIFICATION.MAIL")

        include ../includes/modules/user-settings/mail-notifications-table
